package com.airsystem.pos.bengkel.view.report;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;

import com.airsystem.pos.bengkel.controller.MenuController;
import com.airsystem.pos.bengkel.controller.report.BalanceSheetReportController;

/**
 * @author Budi Oktaviyan <budi.oktaviyan@icloud.com>
 */
public class BalanceSheetReport extends BalanceSheetReportController {

	public BalanceSheetReport(MenuController menuController) {
		super();

		this.menuController = menuController;
		initComponents();
	}

	private void initComponents() {
		setTitle("Laporan Balance Sheet");
		setFrameIcon(new ImageIcon(getClass().getResource("/images/balance.png")));
		setIconifiable(true);
		setClosable(true);

		baseLayout.columnWidths = new int[] { 0 };
		baseLayout.rowHeights = new int[] { 0, 0 };
		baseLayout.columnWeights = new double[] { 1.0 };
		baseLayout.rowWeights = new double[] { 1.0, 1.0 };
		getContentPane().setLayout(baseLayout);

		panelLayout.columnWidths = new int[] { 0, 0, 0 };
		panelLayout.rowHeights = new int[] { 0 };
		panelLayout.columnWeights = new double[] { 0.0, 1.0, 1.0 };
		panelLayout.rowWeights = new double[] { 0.0 };
		basePanel.setLayout(panelLayout);

		periodeLabel.setFont(new Font("Verdana", 0, 12));
		periodeLabel.setText("Periode");

		bulanCombo.setFont(new Font("Verdana", 0, 12));

		tahunCombo.setFont(new Font("Verdana", 0, 12));

		buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 15));

		printButton.setIcon(new ImageIcon(getClass().getResource("/images/print.png")));
		printButton.setFont(new Font("Verdana", 1, 12));
		printButton.setText("CETAK");
		buttonPanel.add(printButton);

		printButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent evt) {
				printButtonActionPerformed(evt);
			}
		});

		basePanel.add(periodeLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(35, 15, 30, 0), 0, 0));
		basePanel.add(bulanCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(35, 15, 30, 0), 0, 0));
		basePanel.add(tahunCombo, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(35, 15, 30, 20), 0, 0));

		getContentPane().add(basePanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
		getContentPane().add(buttonPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(40, 0, 0, 0), 0, 0));

		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		setBounds((screenSize.width - 500) / 2, (screenSize.height - 500) / 2, 500, 250);
	}

	private void printButtonActionPerformed(ActionEvent evt) {
		print();
	}
}